<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Admin_model extends CI_Model {
	
    public function __construct(){
        parent::__construct();
    }
	
	public function login_user($username,$password){
		/*从表中获取用户的相关信息，返回一个数组*/
		$query=$this->db->get_where('admin',array('username'=>$username,'password'=>$password));
		return $query->row_array();
	}

	public function get_user(){
		/*获取admin表的内容返回数组*/
	    $query=$this->db->get('admin');
		return $query->row_array();
		
	}
	public function update($data){
		/*生成where子句*/
		$this->db->where('uid',1);
		/*生成update子句*/
		$this->db->update('admin',$data);
		/*返回影响行数*/
		return $this->db->affected_rows();
		}

	
}